Skip to content

fix(web): scope Composer drafts to Sessions - #480

Open
627150795 wants to merge 2 commits into
openpi-dev:mainfrom
627150795:codex/issue-457-composer-drafts
Open

fix(web): scope Composer drafts to Sessions#480
627150795 wants to merge 2 commits into
openpi-dev:mainfrom
627150795:codex/issue-457-composer-drafts

Conversation

@627150795

Copy link
Copy Markdown
Contributor

Problem

Web Composer drafts are local to the component instead of the selected Session. Switching Sessions can show the previous Session's draft, and a late successful send receipt clears newer text typed after the send. Fixes #457.

Value

Users no longer lose new input when a send settles late, and drafts from one Session cannot appear in another Session. Failed sends remain editable.

Approach

  • Pass the store's selected Session path into Composer as the draft scope.
  • Clear drafts when the Session or new-workspace scope changes.
  • Track draft revisions so a send only clears the exact unchanged draft it submitted.
  • Transfer a pending new-workspace draft to the created Session until its first send is accepted.
  • Add focused regressions for delayed and retyped sends, failed sends, Session changes, late receipts, and new-Session creation.

Validation

  • bunx vitest run tests/web/app-render.spec.ts — 17 passed.
  • bun run check — passed.
  • git diff --check — passed.
  • bun run test — run; two unrelated existing/environment-sensitive failures remain: the Windows Git process test reports -1 instead of 7, and the detached launch-card repaint test fails. The focused Web Composer suite passes.

Impact

  • User-visible behavior: drafts are Session-scoped and newer edits are preserved.
  • Model-visible context/tools: None.
  • Runtime/lifecycle: None.
  • Persisted config/data: None; drafts remain in memory and are not written to localStorage.
  • Compatibility/risk: limited to the Web Composer's local draft lifecycle.

@627150795
627150795 force-pushed the codex/issue-457-composer-drafts branch from 28bee59 to 180892f Compare September 8, 2026 16:33

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at exact head 180892f.

Standards

[P1] Draft ownership prefers selectedPath whenever it is non-null, but setWorkspace() enables a workspace draft without clearing the previous Session path. Switching from Session A to a new draft in workspace B therefore keeps A’s scope and unsent text visible in B, where it can be submitted to the wrong repository. Draft mode must prefer new:${selectedWorkspace} or the store must atomically clear selectedPath; add an active-A → workspace-B regression.

Spec

[P1] Manual new-Session creation loses an unsent workspace draft. Transfer is allowed only when pendingSubmission exists; if the user types a workspace draft and clicks New Session before submitting, the path changes and the normal scope-change effect clears the draft. Add explicit transfer semantics and a manual-creation test.

[P2] A second Enter while admission is pending replaces pendingSubmission.current before the store rejects the duplicate. When the original send succeeds, its identity no longer matches and the already-sent text remains available for accidental resend. Guard the UI send path while pending or preserve the original pending identity, with a rapid double-Enter test.

Focused tests and bundle parity pass, but the requested real-browser delayed-network path is not covered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Web UX][P2] 输入草稿缺少会话归属,迟到发送回执会清空新输入

2 participants